package org.example.demo02;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class Test {
    //2.使用字符流 读取文件的内容并打印输出到控制台 (文件目录：C:/test01/02.txt)
    public static void main(String[] args) {
        try {
           BufferedReader reader= new BufferedReader(new FileReader("C:\\demo01\\01.txt"));
            char[] buf = new char[10];
            int len = -1;
            while((len = reader.read(buf))!=-1){
                String s = new String(buf,0,len);
                System.out.println(s);
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
